"""
自己发挥想象力，制作一个剪刀石头布的游戏。
要求，在命令行玩耍就可以了，不需要考虑GUI。
"""
import random

# 定义石头、剪刀、布
choices = ["石头", "剪刀", "布"]

# 定义获胜规则字典
winning_rules = {
    "石头": "剪刀",
    "剪刀": "布",
    "布": "石头"
}

while True:
    # 玩家输入选择
    player_choice = input("请输入石头、剪刀或布（输入'退出'结束游戏）：")

    if player_choice == "退出":
        break

    # 电脑随机选择
    computer_choice = random.choice(choices)

    if player_choice == computer_choice:
        print(f"你选择了{player_choice}，电脑选择了{computer_choice}，结果：平局")
    elif winning_rules[player_choice] == computer_choice:
        print(f"你选择了{player_choice}，电脑选择了{computer_choice}，结果：你赢了")
    else:
        print(f"你选择了{player_choice}，电脑选择了{computer_choice}，结果：你输了")